if (typeof(App.ProjectEditActive) == "undefined") {

/*
 * プロジェクトタブ管理ページクラス
 */
App.ProjectEditActive = function()
{
    // スーパークラスコンストラクタ呼び出し
    App.ProjectEditActive.superclass.constructor.call(this);
};


var _project_edit_active = {
    
    /**
     * onDocLoaded
     * ページ読み込み完了後イベント
     */
    onDocLoaded : function(eventObject, target)
    {
        // スーパークラスの処理を実行
        App.ProjectEditActive.superclass.onDocLoaded.call(this, eventObject, target);

        this.fncRender();// ページレンダリング
        this.fncSetEvent();// 各イベント設定
    },

    onClickProjectAdd : function(e)
    {
        var _prefix = 'update_active_link_add_';
        var target  = new Ext.Element(e.getTarget());
        var parent  = target.parent();
        var project_id = parent.id.replace(_prefix, '');
        
        LayoutPage.fncAddTab(project_id, '');
        this.fncToggleProjectAvailable(project_id);
    },

    onClickProjectRemove : function(e)
    {
        var _prefix = 'update_active_link_remove_';
        var target  = new Ext.Element(e.getTarget());
        var parent  = target.parent();
        var project_id = parent.id.replace(_prefix, '');
        
        LayoutPage.fncRemoveTab(project_id, '');
        this.fncToggleProjectAvailable(project_id);
    },

    fncToggleProjectAvailable : function(project_id)
    {
        var _add_element    = Ext.get('update_active_link_add_'+project_id);
        var _remove_element = Ext.get('update_active_link_remove_'+project_id);
        var is_displayed = _add_element.isDisplayed();
        if (is_displayed) {
            _add_element.setDisplayed(false);
            _remove_element.setDisplayed(true);
        } else {
            _add_element.setDisplayed(true);
            _remove_element.setDisplayed(false);
        }
    },

    /**
     * fncRender
     * ページエレメントを描画
     */
    fncRender : function()
    {
        
    },
    
    /**
     * fncSetEvent
     * ページエレメントへのイベント登録
     */
    fncSetEvent : function()
    {
        this.fncSetEventForProjects();
    },

    fncSetEventForProjects : function()
    {
        var _enable_projects  = Ext.query('a.update_active_link_add');
        Ext.each(_enable_projects, function(e) {
            Ext.get(e).addListener('click', this.onClickProjectAdd, this, true);
        }, this);
        var _disable_projects = Ext.query('a.update_active_link_remove');
        Ext.each(_disable_projects, function(e) {
            Ext.get(e).addListener('click', this.onClickProjectRemove, this, true);
        }, this);
    }

};


// App.Pageを継承
Ext.extend(App.ProjectEditActive, App.Page, _project_edit_active);
App.Page.thispage = new App.ProjectEditActive() ;
}// endof if (typeof(App.ProjectEditActive) == "undefined")